//index.js
//获取应用实例
const app = getApp()
const db = wx.cloud.database();
const list = db.collection('place');
var hoteldata = require('../../data/hoteldata.js')
Page({
  data: {
    imgListTwo: [
      [
        'cloud://cloud1-5gnxbga2f5eed8c0.636c-cloud1-5gnxbga2f5eed8c0-1305796051/image/8.png',
        'cloud://cloud1-5gnxbga2f5eed8c0.636c-cloud1-5gnxbga2f5eed8c0-1305796051/image/8.png'
      ]
    ],
    placesList: []
  },
  onLoad:function(options){
    this.setData({
      goods:hoteldata.hotel
    })
    const _this = this
    wx.cloud.callFunction({
      name: 'getAllPlace',
    }).then(res =>{
      console.log(res)
      _this.data.placesList = res.data
      _this.setData({
        placesList: res.result.data
      })
    })
  },

  goodDetail(event) {
    wx.navigateTo({
      url: 'https://hotels.ctrip.com/domestic/hotel/taiyuan105?allianceid=4897&sid=155938&relatedate=2&gclid=ciro6mc4ouicfvozvaodsgoh7w&gclsrc=ds&checkin=2019-05-19&checkout=2019-05-20',
    })
  },
  gotaobao: function () {
    wx.navigateTo({
      url: '../../out/taobao/taobao', //
      success: function () {
      },       //成功后的回调；
      fail: function () { },         //失败后的回调；
      complete: function () { }      //结束后的回调(成功，失败都会执行)
    })
  },
  toDetail: function(e)
  {
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/place/place?id=' + id,
    })
  }
})
